﻿using AngleExpress.viewmodel;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace AngleExpress.converter
{
    [ValueConversion(typeof(ProgramCategory), typeof(string))]
    class CategoryConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return "";
            }

            var category = (ProgramCategory)value;
            if (category == ProgramCategory.DeskTop)
            {
                return " 桌面程序 ";
            }
            else if (category == ProgramCategory.Web)
            {
                return "    网站    ";
            }
            else
            {
                return "";
            }

        }


        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
